package com.alipay.service.interfaced.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.alipay.service.interfaced.AlipayInManager;
import com.business.service.interfaced.impl.ProductInService;
import com.honour.service.interfaced.CartInManager;
import com.honour.service.interfaced.CouponInManager;
import com.honour.service.interfaced.OrderManager;
import com.honour.service.interfaced.ProductInManager;
import com.system.dao.DaoSupport;
import com.system.util.PageData;
//alipayInService可能与其他冲突
@Service("alipayInManager")
public class AlipayInService implements AlipayInManager{
	
	
	@Resource(name="daoSupport")
	private DaoSupport dao;
	
	@Resource(name = "orderService")
	private OrderManager orderService;

	@Resource(name = "cartInService")
	private CartInManager cartInService;

	@Resource(name = "couponInService")
	private CouponInManager couponInService;

	@Resource(name = "proInService")
	private ProductInManager proInService;

	@Resource(name = "productInService")
	private ProductInService productInService;


	/**
	 * 支付宝回调成功后添加支付信息
	 */
	@Override
	public void addPayInfo(PageData pd)throws Exception {
		dao.save("PayInfoMapper.save", pd);
	}


	/**
	 * 查询支付信息
	 */
	@Override
	public PageData getPayInfo(PageData pd) throws Exception {
		return (PageData) dao.findForObject("PayInfoMapper.getPayInfo", pd);
	}


	/**
	 * 支付宝或微信退款成功后添加退款信息
	 */
	@Override
	public void addRefundInfo(PageData pd) throws Exception {
		dao.save("RefundMapper.addRefundInfo", pd);
	}


	/**
	 *  根据用户id查询退款信息列表
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getRefundList(PageData pd) throws Exception {
		return (List<PageData>)dao.findForList("RefundMapper.getRefundList", pd);
	}


	/**
	 * 支付宝或微信退款成功后修改退款信息
	 */
	@Override
	public void updRefund(PageData pd) throws Exception {
		dao.update("RefundMapper.updRefund", pd);
	}


	/**
	 * 根据商家订单号查询退款信息
	 */
	@Override
	public PageData getRefundByNum(PageData pd) throws Exception {
		return (PageData) dao.findForObject("RefundMapper.getRefundByNum", pd);
	}

}
